var circle=null;
	var map;
	var marker;
   var infowindow=null;

   //初始化地图
function initialize(){
    var mapOptions = {
      center: new google.maps.LatLng(35.86166,104.19539699999996),
       mapTypeId: google.maps.MapTypeId.ROADMAP,
	   mapTypeControl: false, 
	   scaleControl:true,
	   streetViewControl:false,
	   //启用/停用双击功能
	   disableDoubleClickZoom:true,
	    navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, 
	   zoom:zoomLevel
    };
    

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
	
	var geocoder = new google.maps.Geocoder();
			geocoder.geocode( { 'address': address}, function(results, status) {
		      if (status == google.maps.GeocoderStatus.OK) {
				map.setCenter(results[0].geometry.location);
				map.setZoom(zoomLevel);
		      }
		    });
   /*
 google.maps.event.addListener(map,'zoom_changed',function() {
         if (map.getZoom() != zoomLevel) map.setZoom(zoomLevel);
    });
*/

	 google.maps.event.addListener(map,'click',function(event){
	   var populationOptions = {
	   	clickable:false,
        strokeColor: "#FF0000",
        strokeOpacity: 0.9,
        strokeWeight: 0,
        fillColor: "#FF0000",
        fillOpacity: 0.20,
        map: map,
        center: event.latLng,
        radius:radius
      };
	  
	  if(circle==null)
	  {
	  	 circle = new google.maps.Circle(populationOptions);
	  }else
	  {
	  	 circle.setOptions({center:event.latLng});
	  }
	  map.panTo(event.latLng);
	  
	  
	  
			if(marker==null)
			{
				 marker = new google.maps.Marker({       
			position: event.latLng,        
			map: map});
			}else
			{
				 marker.setPosition(event.latLng);
			}
	  if(infowindow==null)
	  {
	  	  infowindow = new google.maps.InfoWindow({
		        position: event.latLng
		    });
	  }else
	  {
	  	infowindow.setPosition(event.latLng);
	  }
	  $.getJSON("dic!loadListByLatLng.action",{latlng:event.latLng.lng()+","+event.latLng.lat(),searchStr:searchStr,radius:radius},function(data){
	  	   var html='<div>'+
		    	'<div >'+
		         '   <ul>';
			for(var i=0;i<data.length;i++)
			{
				html+= '<li><a target="_blank" href="business!businessList.action?searchStr='+data[i].provinceId+'_'+data[i].cityId+'_'+data[i].countiesId+'_'+data[i].id+'">'+data[i].loadName+'</a></li>';
			}
			html+='	</ul>'+
				'</div>';
		    '</div>';
			infowindow.setContent(html);
			infowindow.open(map,marker);
			google.maps.event.addListener(marker, 'click', function() {   infowindow.open(map,marker); });
	  });
    });
	
	
}

